 |
c character sets |
C Character
Set:
A C program is
a collections of number of instructions written in meaningful order.
Further instructions
are made up of Keyword, Variables and Functions etc which
uses the C
character set defined by C. It is collections of various
characters, digits, and
symbols which can be used in a C program. It
comprises followings below:-
 |
symbols in c |
‘C’ Tokens:
Smallest individual unit in a C
program is called C token. Our C program are
building by using these tokens.
They are use in C program in different-different
ways. In C there are five types
of tokens as followings below:-
 |
token in c |
1.Keywords:-
Keywords are those words whose
meaning has already been known to the
system or compiler. That is meaning of
each keywords is fixed. You can only use
the keyword for its predefined
meaning. You cannot change the meaning of
keywords. Also you cannot use
keywords as names for Variables, Functions.
Arrays etc. All the keywords are
written in small case letters. In C 32 keywords
are available as followings
below:-
 |
keywords in c |
2.Identifiers:-
Identifiers are names given to
various program elements like Variables, Structures,Union, Constants
-names, Macros etc.
Rules for writing identifiers as
followings below:-
#1. First letter must be an alphabet
or underscore ( _ ).
#2. From second character onwords any
combinations of digits, alphabets, or
underscore is allowed.
#3. Only digits, alphabets,
underscore, are allowed. No other symbols is allowed.
#4. Keywords cannot be used as
identifiers.
#5. For ANSI (American National
Standard Institute) C maximum length of
identifiers is 32,but many
compiler support more than 32.
Examples of Valid and Invalid
Identifiers (On the basis of above rules):-
 |
valid invalid identifiers in c |
3.Constants:-
Constants in C programming language refer to
fixed values that do not change during the execution of a program. There are
various types of constants in C. They are classified into followings categories
as below:-
 |
constants in c |
#1. Numeric Constants:- There
are two types of numeric constants as followings below:-
#A. Integer Constants:- Integer constants also have further types as
followings below:-
#a. Decimal
Constants:- They are sequence of digits from 0 to 9 without
fractional
part. It may be negative, positive or zero.
Example: 22, 817, -8137, 0.
#b. Octal
Constants:- They have sequence of numbers from 0 to 7 and first
digit
must be 0.
Example: 045, 0, 0671, 028.
#c. Hex
Decimal Constants:- They have sequence of digits from 0 to 9 and
(Represents 10 to 15). They start with 0x or 0X.
Example: 0x37, 0xab17, 0X81AB.
#B. Real Constants:-They are the number with fractional part. They also known as
floating
point
constants.
Example: 45.67, 0.78, 5.278.
Real constants
can be also be represented in exponential or scientific notation which
consists of two
part. For example the number 212.345 can be represented as
where e+2
means 10 to the power 2. Here the portion before the e that 2.12345
is is known
mantissa and +2 is the exponent.
#2. Non Numeric Constants:- They are two type as followings below:-
#A. Single Character Constants:-They are enclosed in
single quotes.They consists of
single character or
digit. Character constants have integer values known as ASCII
(American Standard
Institute Code for Information Interchange)values
Example:ASCII value Of A
is 65.
#B. String Constants:- They are sequence of characters, digits, or any
symbols enclosed
in double
quotes.
Example: “Hello
World”, “15 August 1947”, “Hello C 1978”, “145.18891B”.
Backslash
Constants:- C defines several backslash
character constants which are used
for special purpose. They are called so
because each constants start with backslash (\).
They are represented with 2 characters whose
general form is \char but treated as a single
character. They are also called
escape sequences. You will see their usage in others post.
Backslash constants
are as followings below:-
 |
backslash constants in c |
4.Operators:-
The operators
are the symbols, they performs operation with operands
Example: 12+14
Here 12 and 14 are operands and + is
Arithmetic operator that will generate results 26. We will learn more about
Operators and Operands in Next Post. Operators are as followings below:-
 |
operators in c |
5.Special
Symbols:-
They are also known as
separators. They are use in our program like Arrays, Functions and
Function,
Structure, Union and Others Blocks of Codes.
They are three type followings
below:-
 |
special symbols in c |